A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Library Naming Tips For Cross Platform


With regards to the freepascal compiler:
library lib1test;

procedure something; stdcall; 
begin
  writeln('test');
end;

exports
  something;
begin
end.
Don't name your library something like "librarytest" or "lib1test" because if you are compiling on linux this is confusing for the compiler when you try to IMPORT your library functions and procedures. The compiler will interpret the "lib" part of your name and find it redundant on linux, and trim it for you when you didn't mean it to. Libraries on linux and windows should be named anything BUT something with the letters "lib" in them.

Since linux adds the lib prefix for you, having two "lib"s in your library will only confuse the compiler. If your library is called "librarytest" and youtry to compile an executable linking to this library, the compiler will actually try and pull in "rarytest" instead of "liblibrarytest".

About
This site is about programming and other things.
_ _ _